{extend name='public/base' /}
{block name='content'}
{include file='public/content_header' /}
<style>
    .tishi{
        color: #5cb85c;
        position: absolute;
        z-index: 5;
        left: 280px;
        width: 100%;
        top: 5px;
        font-size: 14px;
    }

</style>
<section class="content">

    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <!-- 表单头部 -->
                <div class="box-header with-border">
                    <div class="btn-group">
                        <a class="btn flat btn-sm btn-default BackButton">
                            <i class="fa fa-arrow-left"></i>
                            返回
                        </a>
                    </div>
                </div>
                <!-- 表单 -->
                <form id="dataForm" class="form-horizontal dataForm" action="" method="post"
                      enctype="multipart/form-data">
                    <!-- 表单字段区域 -->
                    <div class="box-body">
                        <div class="form-group">
                            <label for="sick_leave_allowance_base" class="col-sm-2 control-label">病假补助基数</label>
                            <div class="col-sm-10 col-md-4">
                                <div class="input-group">
                                    <input id="sick_leave_allowance_base" name="sick_leave_allowance_base" value="{$sick_leave_allowance_base|default=''}" placeholder="请输入病假补助基数" type="number" class="form-control field-number"><span class="tishi" style="color: #5cb85c">比如2050</span>
                                </div>
                            </div>
                        </div>
                        <script>
                            $('#sick_leave_allowance_base')
                                .bootstrapNumber({
                                    upClass: 'success',
                                    downClass: 'primary',
                                    center: true
                                });
                        </script>
                        <div class="form-group">
                            <label for="late_times_limit" class="col-sm-2 control-label">迟到几次扣全勤奖</label>
                            <div class="col-sm-10 col-md-4">
                                <div class="input-group">
                                    <input id="late_times_limit" name="late_times_limit" value="{$late_times_limit|default=''}" placeholder="请输入迟到几次扣全勤奖" type="number" class="form-control field-number"><span class="tishi" style="color: #5cb85c">比如3次</span>
                                </div>
                            </div>
                        </div>
                        <script>
                            $('#late_times_limit')
                                .bootstrapNumber({
                                    upClass: 'success',
                                    downClass: 'primary',
                                    center: true
                                });
                        </script>
                        <div class="form-group">
                            <label for="late_rule_time_money0" class="col-sm-2 control-label">迟到时间节点(分钟)=元</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="late_rule_time0" name="late_rule_time_money[0][time]" value="{$late_rule_time_money[0]['time']|default=''}" placeholder="超过分钟数" type="text" class="form-control field-text">
                                <input id="late_rule_money0" name="late_rule_time_money[0][money]" value="{$late_rule_time_money[0]['money']|default=''}" placeholder="扣款金额" type="text" class="form-control field-text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="late_rule_time_money1" class="col-sm-2 control-label">迟到时间节点(分钟)=元</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="late_rule_time1" name="late_rule_time_money[1][time]" value="{$late_rule_time_money[1]['time']|default=''}" placeholder="不超过分钟数" type="text" class="form-control field-text">
                                <input id="late_rule_money1" name="late_rule_time_money[1][money]" value="{$late_rule_time_money[1]['money']|default=''}" placeholder="扣款金额（元）" type="text" class="form-control field-text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="late_rule_time_money2" class="col-sm-2 control-label">迟到时间节点(分钟)=元</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="late_rule_time2" name="late_rule_time_money[2][time]" value="{$late_rule_time_money[2]['time']|default=''}" placeholder="不超过分钟数" type="text" class="form-control field-text">
                                <input id="late_rule_money2" name="late_rule_time_money[2][money]" value="{$late_rule_time_money[2]['money']|default=''}" placeholder="扣款金额" type="text" class="form-control field-text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="late_rule_time_money3" class="col-sm-2 control-label">其他迟到时间分钟数</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="late_rule_time3" name="late_rule_time_money[3][time]" readonly value="其他时间" placeholder="其他时间" type="text" class="form-control field-text">
                                <input id="late_rule_money3" name="late_rule_time_money[3][money]" placeholder="事假处理" value="事假处理" readonly type="text" class="form-control field-text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="repair_card_times_limit" class="col-sm-2 control-label">补卡扣款开始次数</label>
                            <div class="col-sm-10 col-md-4">
                                <div class="input-group">
                                    <input id="repair_card_times_limit" name="repair_card_times_limit" value="{$repair_card_times_limit|default=''}" placeholder="请输入补卡扣款开始次数" type="number" class="form-control field-number">
                                </div>
                            </div>
                        </div>
                        <script>
                            $('#repair_card_times_limit')
                                .bootstrapNumber({
                                    upClass: 'success',
                                    downClass: 'primary',
                                    center: true
                                });
                        </script>

                        <div class="form-group">
                            <label for="repair_card_times_hour" class="col-sm-2 control-label">补卡每次扣款小时数</label>
                            <div class="col-sm-10 col-md-4">
                                <div class="input-group">
                                    <input id="repair_card_times_hour" name="repair_card_times_hour" value="{$repair_card_times_hour|default=''}" placeholder="请输入每次扣款小时数" type="number" class="form-control field-number">
                                </div>
                            </div>
                        </div>
                        <script>
                            $('#repair_card_times_hour')
                                .bootstrapNumber({
                                    upClass: 'success',
                                    downClass: 'primary',
                                    center: true
                                });
                        </script>
                        <div class="form-group">
                            <label for="repair_card_times_max" class="col-sm-2 control-label">补卡多少次扣全勤</label>
                            <div class="col-sm-10 col-md-4">
                                <div class="input-group">
                                    <input id="repair_card_times_max" name="repair_card_times_max" value="{$repair_card_times_max|default=''}" placeholder="请输入补卡多少次扣全勤" type="number" class="form-control field-number">
                                </div>
                            </div>
                        </div>
                        <script>
                            $('#repair_card_times_max')
                                .bootstrapNumber({
                                    upClass: 'success',
                                    downClass: 'primary',
                                    center: true
                                });
                        </script>
                        <div class="form-group">
                            <label for="in_department" class="col-sm-2 control-label">内职绩效分数最大值</label>
                            <div class="col-sm-10 col-md-4">
                                <div class="input-group">
                                    <input id="in_department" name="in_department" value="{$in_department|default=''}" placeholder="请输入内职绩效分数最大值" type="number" class="form-control field-number">
                                </div>
                            </div>
                        </div>
                        <script>
                            $('#in_department')
                                .bootstrapNumber({
                                    upClass: 'success',
                                    downClass: 'primary',
                                    center: true
                                });
                        </script>
                        <div class="form-group">
                            <label for="in_miss_card_cut" class="col-sm-2 control-label">内职缺卡扣时薪小时数</label>
                            <div class="col-sm-10 col-md-4">
                                <div class="input-group">
                                    <input id="in_miss_card_cut" name="in_miss_card_cut" value="{$in_miss_card_cut|default=''}" placeholder="内职缺卡扣时薪小时数" type="number" class="form-control field-number">
                                </div>
                            </div>
                        </div>
                        <script>
                            $('#in_miss_card_cut')
                                .bootstrapNumber({
                                    upClass: 'success',
                                    downClass: 'primary',
                                    center: true
                                });
                        </script>

                        <div class="form-group">
                            <label for="out_department" class="col-sm-2 control-label">市场绩效分数最大值</label>
                            <div class="col-sm-10 col-md-4">
                                <div class="input-group">
                                    <input id="out_department" name="out_department" value="{$out_department|default=''}" placeholder="请输入市场绩效分数最大值" type="number" class="form-control field-number">
                                </div>
                            </div>
                        </div>
                        <script>
                            $('#out_department')
                                .bootstrapNumber({
                                    upClass: 'success',
                                    downClass: 'primary',
                                    center: true
                                });
                        </script>
                        <div class="form-group">
                            <label for="miss_card_cut" class="col-sm-2 control-label">市场缺打卡扣款</label>
                            <div class="col-sm-10 col-md-4">
                                <div class="input-group">
                                    <input id="miss_card_cut" name="miss_card_cut" value="{$miss_card_cut|default=''}" placeholder="请输入市场缺卡扣款" type="number" class="form-control field-number">
                                </div>
                            </div>
                        </div>
                        <script>
                            $('#miss_card_cut')
                                .bootstrapNumber({
                                    upClass: 'success',
                                    downClass: 'primary',
                                    center: true
                                });
                        </script>
                        <div class="form-group">
                            <label for="miss_sign_cut" class="col-sm-2 control-label">市场缺签卡扣款</label>
                            <div class="col-sm-10 col-md-4">
                                <div class="input-group">
                                    <input id="miss_sign_cut" name="miss_sign_cut" value="{$miss_sign_cut|default=''}" placeholder="请输入市场缺签卡扣款" type="number" class="form-control field-number">
                                </div>
                            </div>
                        </div>
                        <script>
                            $('#miss_sign_cut')
                                .bootstrapNumber({
                                    upClass: 'success',
                                    downClass: 'primary',
                                    center: true
                                });
                        </script>


                    </div>
                    <!-- 表单底部 -->
                    <div class="box-footer">
                        {:token()}
                        <div class="col-sm-2">
                        </div>
                        <div class="col-sm-10 col-md-4">
                            {if !isset($data)}
                            <div class="btn-group pull-right">
                                <label class="createContinue">
                                    <input type="checkbox" value="1" id="_create" name="_create"
                                           title="继续添加数据">继续添加</label>
                            </div>
                            {/if}
                            <div class="btn-group">
                                <button type="submit" class="btn flat btn-info dataFormSubmit">
                                    保存
                                </button>
                            </div>
                            <div class="btn-group">
                                <button type="reset" class="btn flat btn-default dataFormReset">
                                    重置
                                </button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
<script>

    /** 表单验证 **/
    var url = window.location.href;
    var flag = true;
    if (url.indexOf('edit')>=0){
        flag = false;
    }
    jQuery.validator.addMethod("checkname", function (value, element) {
        var resultval = false;
        jQuery.ajax({
            type: 'post',
            async:false,
            data:{'staff_id':value,'attendance_time':$('#attendance_time').val()},
            url: "{:url('Attendance/nameUnique')}",
            dataType: 'json',
            success: function (result) {
                if (result.code == 0) {
                    resultval = false;
                }
                else {
                    resultval = true;
                }
            },
            error: function () {
            }
        });
        return resultval;

    }, "您的名称重复，请重新输入");
    $("#dataForm").validate({
        // submitHandler:function(form){
        //     let formdata = $('#dataForm').serializeArray();
        //     console.log(formdata);
        //     alert('fffffff');return false;
        //     form.submit();
        // },

        // rules: {
        //     'department_id': {
        //         required: true,
        //     },
        //     'staff_id': {
        //         required: true,
        //         checkname:flag,
        //     },
        //     'attendance_time': {
        //         required: true,
        //     },
        //
        // },
        // messages: {
        //     'department_id': {
        //         required: "部门不能为空",
        //     },
        //     'staff_id': {
        //         required: "员工不能为空",
        //         checkname: '此员工信息已存在',
        //     },
        //     'attendance_time': {
        //         required: "考勤时间不能为空",
        //     },
        //
        // },

    });
</script>
{/block}